<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>分页界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<!--<style>-->
    <!--.layui-table-cell{-->
        <!--display:table-cell;-->
        <!--vertical-align: middle;-->
    <!--}-->
    <!--.layui-table-view{height: 350px!important;}-->
<!--</style>-->
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <form class="layui-form" method="post" action="/work/asset/exportWarranty">
            <input type="hidden" name="applyId" value="${applyId}" />
            <input type="hidden" name="associationNumber" id="associationNumber"/>
        </form>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>



        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 0px !important;text-align: center; margin-top: 20px;">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn" id="btnAdd" >保存</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>





    </div>
</div>
<!--操作-->
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/mobile/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    var applyId='${applyId}';
    var id ='${associationNewId}';
    var tableIns = null;
    var marknumber = 0;
    layui.use(['jquery', 'table', 'page', 'dialog', 'baseutil'], function () {
        var $ = layui.jquery,
            page = layui.page,
            dialog = layui.dialog;

        //获取分页数据
        var url = "/work/wxassocationnewDetail/wxassociationnewdetail/findVoPage?associationNewId="+id+'&applyId='+applyId;
        var cols = [
            {field: 'title', title: '序号', align: 'left', width:80,type:'numbers'},
            {field: 'title', title: '社团名称',align: 'center',width:200},
            {field: 'totalNumber', title: '招新人数', align: 'center',templet:function(d){
                if(d.totalNumber=="0"){
                    return '<div style="height: auto;"><input class="associationNumber" data-input-name="number" type="text" placeholder="请输入" value="" style="border:none;height:20px;line-height:24px;width:100%"></div>';
                }else {
                    return '<div style="height: auto;"><input class="associationNumber" data-input-name="number" value="'+d.totalNumber+'"  type="text" placeholder="请输入" value="" style="border:none;height:20px;line-height:24px;width:100%"></div>';
                }

            }

            }
        ];
        tableIns = page.initDate(cols, url);
        //保存操作
        $("#btnAdd").click(function () {
            var ids = [];
            marknumber=0;
            $(".associationNumber").each(function (e, i) {
                marknumber = marknumber+1;
                //获取input里面的值
               var  number =  $(this).val();
               if(isBlank(number)){
                   dialog.msg("招新人数不能为空");
                   return false;
               }
                if(!isNumber(number)){
                    dialog.msg("招新人数必须为整数");
                    return false;
                }
                ids.push(number);
            });
            if (ids.length > 0) {
                //输入完全的位数判断情况
                if(ids.length == marknumber){
                    $("#associationNumber").val(ids.join(","));
                    $("#save").click();
                }else {
                }
            }

        });

















    });
</script>
</body>
</html>